﻿_spBodyOnLoadFunctionNames.push('DisableInputs');

function DisableInputs() {
    var titleElement = getElementByAttributeValue('title', 'Title');
    var guidElement = getElementByAttributeValue('title', 'ObjectGuid');
    var deleteButton = document.getElementById('Ribbon.ListForm.Edit.Actions.DeleteItem-Large');
    titleElement.readOnly = true;
    titleElement.style.background = '#e6e6e6';
    guidElement.readOnly = true;
    guidElement.style.background = '#e6e6e6';
    deleteButton.style.display = 'none';
}

function getElementByAttributeValue(attribute, value) {
    var allElements = document.getElementsByTagName('*');
    for (var i = 0; i < allElements.length; i++) {
        if (allElements[i].getAttribute(attribute) == value) {
            return allElements[i];
        }
    }
}